home *** CD-ROM | disk | FTP | other *** search
/ Java 1996 August / Java - Summer 1996.iso / kaffe-0.2 / lib / native / java.io / java.io.FileDescriptor.c < prev    next >
C/C++ Source or Header  |  1996-02-11  |  836b  |  40 lines

  1. /*
  2.  * java.io.FileDescriptor.c
  3.  *
  4.  * Copyright (c) 1996 Systems Architecture Research Centre,
  5.  *           City University, London, UK.
  6.  *
  7.  * See the file "license.terms" for information on usage and redistribution
  8.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  9.  *
  10.  * Written by Tim Wilkinson <tim@sarc.city.ac.uk>, February 1996.
  11.  */
  12.  
  13. #include <stdio.h>
  14. #include <assert.h>
  15. #include "java.io.FileDescriptor.h"
  16.  
  17. /*
  18.  * Initialise a file descriptor to the given file nr.
  19.  */
  20. struct Hjava_io_FileDescriptor*
  21. java_io_FileDescriptor_initSystemFD(struct Hjava_io_FileDescriptor* this, long i)
  22. {
  23.     unhand(this)->fd = i;
  24.     return (this);
  25. }
  26.  
  27. /*
  28.  * Is this file descriptor valid ?
  29.  */
  30. long /* bool */
  31. java_io_FileDescriptor_valid(struct Hjava_io_FileDescriptor* this)
  32. {
  33.     if (unhand(this)->fd >= 0) {
  34.         return (1);
  35.     }
  36.     else {
  37.         return (0);
  38.     }
  39. }
  40.